<template>
    <!-- 编辑付费类型 -->
    <the-dialog :cfg="cfg" :loading="loading" :need-close-modal="false" @closed="onClose" @submited="onSubmit">
        <div class="popup-wrapper" slot="body">
            <el-input v-model.trim="detailsEntrust" type="textarea" resize="none" :rows="10" maxlength="255" show-word-limit></el-input>
        </div>
    </the-dialog>
</template>

<script>
    export default {
        name: '',
        data() {
            return {
                cfg: {
                    visible: false,
                    title: '医嘱'
                },
                loading: false,

                patientInfo: {},

                detailsEntrust: ''

            }
        },
        methods: {
            onOpen(detail = {}) {
                this.cfg.visible = true;


                this.patientInfo = Object.assign({}, detail);
                this.detailsEntrust = this.patientInfo.detailsEntrust || '';
            },
            onSubmit() {
                this.loading = true;

                let params = {
                    id: sessionStorage.logId,
                    detailsEntrust: this.detailsEntrust
                }
                this.$ajax.updateEntrustAdvice(params).then(res => {
                    this.$util.message(res.msg, 'success');

                    this.cfg.visible = false;
                    this.loading = false;

                    this.$emit('submited')
                }).catch(err => {
                    this.loading = false;
                    this.$util.message(err.msg);

                })

            },
            onClose() {
                this.cfg.visible = false;
            }
        },
        mounted() {

        }
    }
</script>

<style lang="scss">
    .popup-wrapper {
       
    }
</style>